<?php 
use com\soka\SokaModel;

class Parafiscal_Mdl extends SokaModel
{
	public function get() {
		try {
	        $result = $this->_db->prepare("CALL para");
	        $result->execute();
	        while ($row = $result->fetch(\PDO::FETCH_ASSOC))
	        {
				$data[] = $row;
	        }
	       
        } catch (\PDOException $e) {
            print "Error!: " . $e->getMessage() . "<br/>";
        	die();
        }
        return $data;
	}

	public function insertar($nom, $sena, $icbf, $ccf) 
	{
		try {
	        $result = $this->_db->prepare("CALL sp_insertar_parafiscales_nomina('{$nom}', '{$sena}', '{$icbf}', '{$ccf}')");
	        return $result->execute();
        } catch (\PDOException $e) {
            print "Error!: " . $e->getMessage() . "<br/>";
        	die();
        }
	}


	public function viewparafiscales($nomina) {
		try {
	        $result = $this->_db->prepare("CALL sp_parafiscales_nomina('{$nomina}')");
	        $result->execute();
	        while ($row = $result->fetch(\PDO::FETCH_OBJ))
	        {
				$data[$row->nombre] = $row->valor;
	        }
	       
        } catch (\PDOException $e) {
            print "Error!: " . $e->getMessage() . "<br/>";
        	die();
        }
        return $data;
	}




}